/**
 *
 */
package org.jprobe.codegen;

import java.lang.reflect.Method;
import java.util.Comparator;

/**
 * Methods comparator, can used in sorted sets
 * @author Hussain Al-Mutawa
 * @version 1.0
 * @since 1.0
 */
public final class MethodsComparator implements Comparator<Method> {
	/** this is the only copy created for this object on the application level **/
	private transient final static MethodsComparator INSTANCE = new MethodsComparator();
	/** this class can not be initialized **/
	private MethodsComparator(){super();}

	@Override
	public int compare(final Method method1, final Method method2) {
		return method1.toString().compareTo(method2.toString());
	}
	/**
	 * gets a singleton instance of the comparator
	 * @return instance of the class
	 */
	public static MethodsComparator instance(){
		return INSTANCE;
	}
}
